using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Zosnn.Models.Mapping
{
    public class UserMap : EntityTypeConfiguration<User>
    {
        public UserMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.Name)
                .HasMaxLength(200);

            this.Property(t => t.Mobile)
                .HasMaxLength(50);

            this.Property(t => t.Password)
                .HasMaxLength(50);

            this.Property(t => t.MobileCode)
                .HasMaxLength(200);

            // Table & Column Mappings
            this.ToTable("User");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.Mobile).HasColumnName("Mobile");
            this.Property(t => t.Password).HasColumnName("Password");
            this.Property(t => t.Created).HasColumnName("Created");
            this.Property(t => t.LastLogin).HasColumnName("LastLogin");
            this.Property(t => t.OrderCount).HasColumnName("OrderCount");
            this.Property(t => t.DealCount).HasColumnName("DealCount");
            this.Property(t => t.MobileCode).HasColumnName("MobileCode");
        }
    }
}
